package com.example.recorsion;

/**
 * @className: Demo
 * @description: TODO 类描述
 * @author: LiuZhenHe
 * @date: 2024/01/17 17:37
 **/
public class Demo {

    public static void main(String[] args) {
        System.out.println(factorial(3));
    }

    public static int factorial(int n) {
        if (n == 1) {
            return 1;
        }
        return factorial(n - 1) * n;
    }
}
